//箭头函数中的this
//箭头函数中的this指向的是函数定义位置的上下文的this
const obj = { name: 'zs' }

function fn() {
  console.log(this);
  return () => {
    console.log(this);
  }
}

const resFn = fn.call();
resFn();
/* 
Object [global]
Object [global]
*/
//global即顶级对象

const resFn1 = fn.call(obj);
resFn1();
/* 
{ name: 'zs' }
{ name: 'zs' } 
*/



console.log('-----------');


var age = 18;
var obj1 = {
  age: 20,
  say: () => {
    console.log(this.age);
  }
}

obj1.say();